package org.gczl.core.until;

import java.util.HashMap;
import java.util.Map;

import net.sf.json.JSONObject;

public class sendTemplateMessage {
	
	public static final String appid="wxc27a20949311ca46";
	
	public static final String appSecret="a24c4b4ac725985c272ea3fbe3e6b2a7";
	
	public static final String template_id="w15cj_W63uKGyCEmOltFst9YwExlJAPXzLADfaV0Dy4";
	
	
	public static JSONObject send(String form_id){
		
		JSONObject tokenObj = getAccessToken.getToken();
		String token = tokenObj.getString("access_token");
		System.out.println(tokenObj);
		String url = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send?"
				+ "access_token="+token;
//				+ "touser="+appSecret+"&"
//				+ "template_id="+template_id+"&"
//				+ "form_id"+form_id;
		
		Map<String,String> parm = new HashMap<String,String>();
		parm.put("touser", appid);
		parm.put("template_id", template_id);
		parm.put("form_id", form_id);
		
		
		String s = "{'touser': 'OPENID','template_id': 'TEMPLATE_ID','page': 'index','form_id': 'FORMID','data': {'keyword1': {'value': '339208499'},'keyword2': {'value': '2015年01月05日 12:30'},'keyword3': {'value': '腾讯微信总部'},'keyword4': {'value': '广州市海珠区新港中路397号'},'emphasis_keyword': 'keyword1.DATA'}";
		String result = HttpUtil.doPost(url, parm);
		
		
		return null;
		
	}
	
	
}
